| | | 1 | | // Copyright (c) 2020-2023 dotBunny Inc. |
| | | 2 | | // dotBunny licenses this file to you under the BSL-1.0 license. |
| | | 3 | | // See the LICENSE file in the project root for more information. |
| | | 4 | | |
| | | 5 | | using System; |
| | | 6 | | using GDX.Collections; |
| | | 7 | | using UnityEngine; |
| | | 8 | | |
| | | 9 | | namespace GDX.Tables |
| | | 10 | | { |
| | | 11 | | |
| | | 12 | | [CreateAssetMenu(menuName = "GDX/Stable Table", fileName = "GDXStableTable")] |
| | | 13 | | [Serializable] |
| | | 14 | | public class StableTable : ScriptableObject, ITable |
| | | 15 | | { |
| | | 16 | | [Serializable] |
| | | 17 | | internal struct ColumnEntry |
| | | 18 | | { |
| | | 19 | | public Serializable.SerializableTypes ColumnType; |
| | | 20 | | public int columnDenseIndex; |
| | | 21 | | } |
| | | 22 | | |
| | | 23 | | [SerializeField] internal ArrayHolder<string>[] allStringColumns; |
| | | 24 | | [SerializeField] internal ArrayHolder<bool>[] allBoolColumns; |
| | | 25 | | [SerializeField] internal ArrayHolder<char>[] allCharColumns; |
| | | 26 | | [SerializeField] internal ArrayHolder<sbyte>[] allSbyteColumns; |
| | | 27 | | [SerializeField] internal ArrayHolder<byte>[] allByteColumns; |
| | | 28 | | [SerializeField] internal ArrayHolder<short>[] allShortColumns; |
| | | 29 | | [SerializeField] internal ArrayHolder<ushort>[] allUshortColumns; |
| | | 30 | | [SerializeField] internal ArrayHolder<int>[] allIntColumns; |
| | | 31 | | [SerializeField] internal ArrayHolder<uint>[] allUintColumns; |
| | | 32 | | [SerializeField] internal ArrayHolder<long>[] allLongColumns; |
| | | 33 | | [SerializeField] internal ArrayHolder<ulong>[] allUlongColumns; |
| | | 34 | | [SerializeField] internal ArrayHolder<float>[] allFloatColumns; |
| | | 35 | | [SerializeField] internal ArrayHolder<double>[] allDoubleColumns; |
| | | 36 | | [SerializeField] internal ArrayHolder<Vector2>[] allVector2Columns; |
| | | 37 | | [SerializeField] internal ArrayHolder<Vector3>[] allVector3Columns; |
| | | 38 | | [SerializeField] internal ArrayHolder<Vector4>[] allVector4Columns; |
| | | 39 | | [SerializeField] internal ArrayHolder<Vector2Int>[] allVector2IntColumns; |
| | | 40 | | [SerializeField] internal ArrayHolder<Vector3Int>[] allVector3IntColumns; |
| | | 41 | | [SerializeField] internal ArrayHolder<Quaternion>[] allQuaternionColumns; |
| | | 42 | | [SerializeField] internal ArrayHolder<Rect>[] allRectColumns; |
| | | 43 | | [SerializeField] internal ArrayHolder<RectInt>[] allRectIntColumns; |
| | | 44 | | [SerializeField] internal ArrayHolder<Color>[] allColorColumns; |
| | | 45 | | [SerializeField] internal ArrayHolder<LayerMask>[] allLayerMaskColumns; |
| | | 46 | | [SerializeField] internal ArrayHolder<Bounds>[] allBoundsColumns; |
| | | 47 | | [SerializeField] internal ArrayHolder<BoundsInt>[] allBoundsIntColumns; |
| | | 48 | | [SerializeField] internal ArrayHolder<Hash128>[] allHash128Columns; |
| | | 49 | | [SerializeField] internal ArrayHolder<Gradient>[] allGradientColumns; |
| | | 50 | | [SerializeField] internal ArrayHolder<AnimationCurve>[] allAnimationCurveColumns; |
| | | 51 | | [SerializeField] internal ArrayHolder<UnityEngine.Object>[] allObjectRefColumns; |
| | 0 | 52 | | [SerializeField] internal ArrayHolder<string>[] allColumnNames = new ArrayHolder<string>[Serializable.Serializab |
| | | 53 | | |
| | | 54 | | [SerializeField] internal int[] rowIDToDenseIndexMap; |
| | | 55 | | [SerializeField] internal int[] rowDenseIndexToIDMap; |
| | | 56 | | [SerializeField] internal string[] rowNames; |
| | | 57 | | [SerializeField] internal int rowEntriesFreeListHead; |
| | | 58 | | |
| | | 59 | | [SerializeField] |
| | | 60 | | internal int rowCount; |
| | | 61 | | |
| | | 62 | | [SerializeField] internal ColumnEntry[] columnIDToDenseIndexMap; |
| | | 63 | | [SerializeField] internal int[] columnIDToSortOrderMap; |
| | | 64 | | [SerializeField] internal int[] sortedOrderToColumnIDMap; |
| | | 65 | | |
| | | 66 | | // TODO move with other block |
| | 0 | 67 | | [SerializeField] ArrayHolder<int>[] columnDenseIndexToIDMap = new ArrayHolder<int>[Serializable.SerializableType |
| | | 68 | | |
| | | 69 | | [SerializeField] |
| | | 70 | | internal int columnEntriesFreeListHead; |
| | | 71 | | |
| | | 72 | | [SerializeField] |
| | | 73 | | internal int combinedColumnCount; |
| | | 74 | | |
| | | 75 | | [SerializeField] |
| | 0 | 76 | | internal ulong dataVersion = 1; |
| | | 77 | | |
| | | 78 | | |
| | | 79 | | public ulong GetDataVersion() |
| | 0 | 80 | | { |
| | 0 | 81 | | return dataVersion; |
| | 0 | 82 | | } |
| | | 83 | | |
| | | 84 | | /// <inheritdoc /> |
| | | 85 | | public int GetColumnCount() |
| | 0 | 86 | | { |
| | 0 | 87 | | return combinedColumnCount; |
| | 0 | 88 | | } |
| | | 89 | | |
| | | 90 | | /// <inheritdoc /> |
| | | 91 | | public int GetRowCount() |
| | 0 | 92 | | { |
| | 0 | 93 | | return rowCount; |
| | 0 | 94 | | } |
| | | 95 | | |
| | | 96 | | public ITable.RowDescription[] GetAllRowDescriptions() |
| | 0 | 97 | | { |
| | 0 | 98 | | if (combinedColumnCount == 0 || rowCount == 0) return null; |
| | 0 | 99 | | ITable.RowDescription[] returnArray = new ITable.RowDescription[rowCount]; |
| | 0 | 100 | | string empty = string.Empty; |
| | 0 | 101 | | for (int i = 0; i < rowCount; i++) |
| | 0 | 102 | | { |
| | 0 | 103 | | returnArray[i].Index = rowDenseIndexToIDMap[i]; |
| | 0 | 104 | | returnArray[i].Name = empty; |
| | 0 | 105 | | } |
| | | 106 | | |
| | 0 | 107 | | return returnArray; |
| | 0 | 108 | | } |
| | | 109 | | public ITable.RowDescription GetRowDescription(string name) |
| | 0 | 110 | | { |
| | 0 | 111 | | for (int i = 0; i < rowCount; i++) |
| | 0 | 112 | | { |
| | 0 | 113 | | string nameAt = rowNames[i]; |
| | | 114 | | |
| | 0 | 115 | | if (nameAt == name) |
| | 0 | 116 | | { |
| | 0 | 117 | | return new ITable.RowDescription |
| | | 118 | | { |
| | | 119 | | Index = rowDenseIndexToIDMap[i], |
| | | 120 | | Name = nameAt |
| | | 121 | | }; |
| | | 122 | | } |
| | 0 | 123 | | } |
| | | 124 | | |
| | 0 | 125 | | throw new ArgumentException("Row with name " + name + " does not exist in the table"); |
| | 0 | 126 | | } |
| | | 127 | | |
| | | 128 | | public ITable.RowDescription GetRowDescription(int order) |
| | 0 | 129 | | { |
| | 0 | 130 | | return new ITable.RowDescription |
| | | 131 | | { |
| | | 132 | | Index = rowDenseIndexToIDMap[order], |
| | | 133 | | Name = rowNames[order] |
| | | 134 | | }; |
| | 0 | 135 | | } |
| | | 136 | | |
| | | 137 | | public ITable.ColumnDescription GetColumnDescription(string name) |
| | 0 | 138 | | { |
| | 0 | 139 | | for (int i = 0; i < Serializable.SerializableTypesCount; i++) |
| | 0 | 140 | | { |
| | 0 | 141 | | string[] columnNames = allColumnNames[i].TArray; |
| | | 142 | | |
| | 0 | 143 | | if (columnNames != null) |
| | 0 | 144 | | { |
| | 0 | 145 | | for (int j = 0; j < columnNames.Length; j++) |
| | 0 | 146 | | { |
| | 0 | 147 | | string nameAt = columnNames[j]; |
| | | 148 | | |
| | 0 | 149 | | if (name == nameAt) |
| | 0 | 150 | | { |
| | 0 | 151 | | int columnID = columnDenseIndexToIDMap[i].TArray[j]; |
| | | 152 | | |
| | 0 | 153 | | ref ColumnEntry columnEntry = ref columnIDToDenseIndexMap[columnID]; |
| | 0 | 154 | | return new ITable.ColumnDescription |
| | | 155 | | { |
| | | 156 | | Index = columnID, |
| | | 157 | | Name = nameAt, |
| | | 158 | | Type = columnEntry.ColumnType |
| | | 159 | | }; |
| | | 160 | | } |
| | 0 | 161 | | } |
| | 0 | 162 | | } |
| | 0 | 163 | | } |
| | | 164 | | |
| | 0 | 165 | | throw new ArgumentException("Column with name " + name + " does not exist in the table"); |
| | 0 | 166 | | } |
| | | 167 | | |
| | | 168 | | public ITable.ColumnDescription GetColumnDescription(int order) |
| | 0 | 169 | | { |
| | 0 | 170 | | int idAtOrderedIndex = sortedOrderToColumnIDMap[order]; |
| | 0 | 171 | | ref ColumnEntry columnEntry = ref columnIDToDenseIndexMap[idAtOrderedIndex]; |
| | | 172 | | |
| | 0 | 173 | | string columnName = allColumnNames[(int)columnEntry.ColumnType][columnEntry.columnDenseIndex]; |
| | | 174 | | |
| | 0 | 175 | | return new ITable.ColumnDescription |
| | | 176 | | { |
| | | 177 | | Index = idAtOrderedIndex, |
| | | 178 | | Name = columnName, |
| | | 179 | | Type = columnEntry.ColumnType |
| | | 180 | | }; |
| | 0 | 181 | | } |
| | | 182 | | |
| | | 183 | | /// <inheritdoc /> |
| | | 184 | | public ITable.ColumnDescription[] GetAllColumnDescriptions() |
| | 0 | 185 | | { |
| | 0 | 186 | | if (combinedColumnCount == 0) return null; |
| | 0 | 187 | | ITable.ColumnDescription[] returnArray = new ITable.ColumnDescription[combinedColumnCount]; |
| | | 188 | | |
| | 0 | 189 | | for (int i = 0; i < combinedColumnCount; i++) |
| | 0 | 190 | | { |
| | 0 | 191 | | int columnID = sortedOrderToColumnIDMap[i]; |
| | 0 | 192 | | Serializable.SerializableTypes columnType = columnIDToDenseIndexMap[columnID].ColumnType; |
| | 0 | 193 | | string name = allColumnNames[(int)columnType][columnIDToDenseIndexMap[columnID].columnDenseIndex]; |
| | | 194 | | |
| | 0 | 195 | | returnArray[i] = new ITable.ColumnDescription |
| | | 196 | | { |
| | | 197 | | Name = name, |
| | | 198 | | Index = columnID, |
| | | 199 | | Type = columnType |
| | | 200 | | }; |
| | 0 | 201 | | } |
| | | 202 | | |
| | 0 | 203 | | return returnArray; |
| | 0 | 204 | | } |
| | | 205 | | |
| | | 206 | | public void SetColumnName(string name, int columnID) |
| | 0 | 207 | | { |
| | 0 | 208 | | ref ColumnEntry columnEntry = ref columnIDToDenseIndexMap[columnID]; |
| | 0 | 209 | | allColumnNames[(int)columnEntry.ColumnType][columnEntry.columnDenseIndex] = name; |
| | 0 | 210 | | } |
| | | 211 | | |
| | | 212 | | public string GetColumnName(int columnID) |
| | 0 | 213 | | { |
| | 0 | 214 | | ref ColumnEntry columnEntry = ref columnIDToDenseIndexMap[columnID]; |
| | 0 | 215 | | return allColumnNames[(int)columnEntry.ColumnType][columnEntry.columnDenseIndex]; |
| | 0 | 216 | | } |
| | | 217 | | |
| | | 218 | | public ref string GetColumnNameRef(int columnID) |
| | 0 | 219 | | { |
| | 0 | 220 | | ref ColumnEntry columnEntry = ref columnIDToDenseIndexMap[columnID]; |
| | 0 | 221 | | return ref allColumnNames[(int)columnEntry.ColumnType][columnEntry.columnDenseIndex]; |
| | 0 | 222 | | } |
| | | 223 | | |
| | | 224 | | |
| | | 225 | | public int AddRow(string rowName = null, int insertAtRowID = -1) |
| | 0 | 226 | | { |
| | 0 | 227 | | int rowID = rowEntriesFreeListHead; |
| | 0 | 228 | | int rowIDToDenseIndexMapLength = rowIDToDenseIndexMap?.Length ?? 0; |
| | 0 | 229 | | if (rowID >= rowIDToDenseIndexMapLength) |
| | 0 | 230 | | { |
| | 0 | 231 | | int newSize = rowID * 2; |
| | 0 | 232 | | newSize = newSize == 0 ? 1 : newSize; |
| | 0 | 233 | | Array.Resize(ref rowIDToDenseIndexMap, newSize); |
| | 0 | 234 | | for (int i = rowID; i < newSize; i++) |
| | 0 | 235 | | { |
| | 0 | 236 | | rowIDToDenseIndexMap[i] = i + 1; |
| | 0 | 237 | | } |
| | 0 | 238 | | } |
| | | 239 | | |
| | 0 | 240 | | int denseIndexToIDMapLength = rowDenseIndexToIDMap?.Length ?? 0; |
| | 0 | 241 | | Array.Resize(ref rowDenseIndexToIDMap, denseIndexToIDMapLength + 1); |
| | 0 | 242 | | Array.Resize(ref rowNames, denseIndexToIDMapLength + 1); |
| | | 243 | | |
| | 0 | 244 | | int insertAt = insertAtRowID < 0 ? rowCount : rowIDToDenseIndexMap[insertAtRowID]; |
| | | 245 | | |
| | 0 | 246 | | for (int i = denseIndexToIDMapLength; i > insertAt; i--) |
| | 0 | 247 | | { |
| | 0 | 248 | | int currentRowID = rowDenseIndexToIDMap[i - 1]; |
| | 0 | 249 | | rowDenseIndexToIDMap[i] = currentRowID; |
| | | 250 | | |
| | 0 | 251 | | rowIDToDenseIndexMap[currentRowID] = i; |
| | | 252 | | |
| | 0 | 253 | | rowNames[i] = rowNames[i - 1]; |
| | 0 | 254 | | } |
| | | 255 | | |
| | 0 | 256 | | rowEntriesFreeListHead = rowIDToDenseIndexMap[rowID]; |
| | 0 | 257 | | rowIDToDenseIndexMap[rowID] = insertAt; |
| | 0 | 258 | | rowDenseIndexToIDMap[insertAt] = rowID; |
| | 0 | 259 | | rowNames[insertAt] = rowName == null ? rowID.ToString() : rowName; |
| | | 260 | | |
| | 0 | 261 | | InsertRowsOfTypeInternal(ref allStringColumns, insertAt, 1); |
| | 0 | 262 | | InsertRowsOfTypeInternal(ref allBoolColumns, insertAt, 1); |
| | 0 | 263 | | InsertRowsOfTypeInternal(ref allCharColumns, insertAt, 1); |
| | 0 | 264 | | InsertRowsOfTypeInternal(ref allSbyteColumns, insertAt, 1); |
| | 0 | 265 | | InsertRowsOfTypeInternal(ref allByteColumns, insertAt, 1); |
| | 0 | 266 | | InsertRowsOfTypeInternal(ref allShortColumns, insertAt, 1); |
| | 0 | 267 | | InsertRowsOfTypeInternal(ref allUshortColumns, insertAt, 1); |
| | 0 | 268 | | InsertRowsOfTypeInternal(ref allIntColumns, insertAt, 1); |
| | 0 | 269 | | InsertRowsOfTypeInternal(ref allUintColumns, insertAt, 1); |
| | 0 | 270 | | InsertRowsOfTypeInternal(ref allLongColumns, insertAt, 1); |
| | 0 | 271 | | InsertRowsOfTypeInternal(ref allUlongColumns, insertAt, 1); |
| | 0 | 272 | | InsertRowsOfTypeInternal(ref allFloatColumns, insertAt, 1); |
| | 0 | 273 | | InsertRowsOfTypeInternal(ref allDoubleColumns, insertAt, 1); |
| | 0 | 274 | | InsertRowsOfTypeInternal(ref allVector2Columns, insertAt, 1); |
| | 0 | 275 | | InsertRowsOfTypeInternal(ref allVector3Columns, insertAt, 1); |
| | 0 | 276 | | InsertRowsOfTypeInternal(ref allVector4Columns, insertAt, 1); |
| | 0 | 277 | | InsertRowsOfTypeInternal(ref allVector2IntColumns, insertAt, 1); |
| | 0 | 278 | | InsertRowsOfTypeInternal(ref allVector3IntColumns, insertAt, 1); |
| | 0 | 279 | | InsertRowsOfTypeInternal(ref allQuaternionColumns, insertAt, 1); |
| | 0 | 280 | | InsertRowsOfTypeInternal(ref allRectColumns, insertAt, 1); |
| | 0 | 281 | | InsertRowsOfTypeInternal(ref allRectIntColumns, insertAt, 1); |
| | 0 | 282 | | InsertRowsOfTypeInternal(ref allColorColumns, insertAt, 1); |
| | 0 | 283 | | InsertRowsOfTypeInternal(ref allLayerMaskColumns, insertAt, 1); |
| | 0 | 284 | | InsertRowsOfTypeInternal(ref allBoundsColumns, insertAt, 1); |
| | 0 | 285 | | InsertRowsOfTypeInternal(ref allBoundsIntColumns, insertAt, 1); |
| | 0 | 286 | | InsertRowsOfTypeInternal(ref allHash128Columns, insertAt, 1); |
| | 0 | 287 | | InsertRowsOfTypeInternal(ref allGradientColumns, insertAt, 1); |
| | 0 | 288 | | InsertRowsOfTypeInternal(ref allAnimationCurveColumns, insertAt, 1); |
| | 0 | 289 | | InsertRowsOfTypeInternal(ref allObjectRefColumns, insertAt, 1); |
| | | 290 | | |
| | 0 | 291 | | ++rowCount; |
| | 0 | 292 | | dataVersion++; |
| | | 293 | | |
| | 0 | 294 | | return rowID; |
| | 0 | 295 | | } |
| | | 296 | | |
| | | 297 | | public void AddRows(int numberOfNewRows, string[] rowNames = null, int insertAtRowID = -1) |
| | 0 | 298 | | { |
| | 0 | 299 | | int rowIDToDenseIndexMapLength = rowIDToDenseIndexMap?.Length ?? 0; |
| | 0 | 300 | | int newCount = rowCount + numberOfNewRows; |
| | 0 | 301 | | if (newCount > rowIDToDenseIndexMapLength) |
| | 0 | 302 | | { |
| | 0 | 303 | | int newSize = newCount; |
| | 0 | 304 | | --newSize; |
| | 0 | 305 | | newSize |= newSize >> 1; |
| | 0 | 306 | | newSize |= newSize >> 2; |
| | 0 | 307 | | newSize |= newSize >> 4; |
| | 0 | 308 | | newSize |= newSize >> 8; |
| | 0 | 309 | | newSize |= newSize >> 16; |
| | 0 | 310 | | ++newSize; |
| | | 311 | | |
| | 0 | 312 | | newSize = newSize == 0 ? 1 : newSize; |
| | 0 | 313 | | Array.Resize(ref rowIDToDenseIndexMap, newSize); |
| | 0 | 314 | | for (int i = rowIDToDenseIndexMapLength; i < newSize; i++) |
| | 0 | 315 | | { |
| | 0 | 316 | | rowIDToDenseIndexMap[i] = i + 1; |
| | 0 | 317 | | } |
| | 0 | 318 | | } |
| | | 319 | | |
| | 0 | 320 | | int denseIndexToIDMapLength = rowDenseIndexToIDMap?.Length ?? 0; |
| | 0 | 321 | | Array.Resize(ref rowDenseIndexToIDMap, denseIndexToIDMapLength + numberOfNewRows); |
| | 0 | 322 | | Array.Resize(ref rowNames, denseIndexToIDMapLength + numberOfNewRows); |
| | | 323 | | |
| | 0 | 324 | | int insertAt = insertAtRowID < 0 ? rowCount : rowIDToDenseIndexMap[insertAtRowID]; |
| | | 325 | | |
| | 0 | 326 | | for (int i = denseIndexToIDMapLength; i > insertAt + numberOfNewRows - 1; i--) |
| | 0 | 327 | | { |
| | 0 | 328 | | int currentRowID = rowDenseIndexToIDMap[i - numberOfNewRows]; |
| | 0 | 329 | | rowDenseIndexToIDMap[i] = currentRowID; |
| | | 330 | | |
| | 0 | 331 | | rowIDToDenseIndexMap[currentRowID] = i; |
| | | 332 | | |
| | 0 | 333 | | rowNames[i] = rowNames[i - numberOfNewRows]; |
| | 0 | 334 | | } |
| | | 335 | | |
| | 0 | 336 | | int freeListHead = rowEntriesFreeListHead; |
| | | 337 | | |
| | 0 | 338 | | for (int i = 0; i < numberOfNewRows; i++) |
| | 0 | 339 | | { |
| | 0 | 340 | | int rowID = freeListHead; |
| | 0 | 341 | | freeListHead = rowIDToDenseIndexMap[rowID]; |
| | 0 | 342 | | rowIDToDenseIndexMap[rowID] = insertAt + i; |
| | 0 | 343 | | rowDenseIndexToIDMap[insertAt + i] = rowID; |
| | 0 | 344 | | } |
| | | 345 | | |
| | 0 | 346 | | int numberOfNewRowNames = rowNames?.Length ?? 0; |
| | 0 | 347 | | string emptyString = string.Empty; |
| | 0 | 348 | | for (int i = 0; i < numberOfNewRowNames; i++) |
| | 0 | 349 | | { |
| | 0 | 350 | | string currentRowName = rowNames[i]; |
| | 0 | 351 | | int rowIDAt = rowDenseIndexToIDMap[insertAt + i]; |
| | 0 | 352 | | rowNames[insertAt + i] = currentRowName == null ? rowIDAt.ToString() : currentRowName; |
| | 0 | 353 | | } |
| | | 354 | | |
| | 0 | 355 | | for (int i = numberOfNewRowNames; i < numberOfNewRows; i++) |
| | 0 | 356 | | { |
| | 0 | 357 | | int rowIDAt = rowDenseIndexToIDMap[insertAt + i]; |
| | 0 | 358 | | rowNames[insertAt + i] = rowIDAt.ToString(); |
| | 0 | 359 | | } |
| | | 360 | | |
| | 0 | 361 | | rowEntriesFreeListHead = freeListHead; |
| | | 362 | | |
| | 0 | 363 | | InsertRowsOfTypeInternal(ref allStringColumns, insertAt, numberOfNewRows); |
| | 0 | 364 | | InsertRowsOfTypeInternal(ref allBoolColumns, insertAt, numberOfNewRows); |
| | 0 | 365 | | InsertRowsOfTypeInternal(ref allCharColumns, insertAt, numberOfNewRows); |
| | 0 | 366 | | InsertRowsOfTypeInternal(ref allSbyteColumns, insertAt, numberOfNewRows); |
| | 0 | 367 | | InsertRowsOfTypeInternal(ref allByteColumns, insertAt, numberOfNewRows); |
| | 0 | 368 | | InsertRowsOfTypeInternal(ref allShortColumns, insertAt, numberOfNewRows); |
| | 0 | 369 | | InsertRowsOfTypeInternal(ref allUshortColumns, insertAt, numberOfNewRows); |
| | 0 | 370 | | InsertRowsOfTypeInternal(ref allIntColumns, insertAt, numberOfNewRows); |
| | 0 | 371 | | InsertRowsOfTypeInternal(ref allUintColumns, insertAt, numberOfNewRows); |
| | 0 | 372 | | InsertRowsOfTypeInternal(ref allLongColumns, insertAt, numberOfNewRows); |
| | 0 | 373 | | InsertRowsOfTypeInternal(ref allUlongColumns, insertAt, numberOfNewRows); |
| | 0 | 374 | | InsertRowsOfTypeInternal(ref allFloatColumns, insertAt, numberOfNewRows); |
| | 0 | 375 | | InsertRowsOfTypeInternal(ref allDoubleColumns, insertAt, numberOfNewRows); |
| | 0 | 376 | | InsertRowsOfTypeInternal(ref allVector2Columns, insertAt, numberOfNewRows); |
| | 0 | 377 | | InsertRowsOfTypeInternal(ref allVector3Columns, insertAt, numberOfNewRows); |
| | 0 | 378 | | InsertRowsOfTypeInternal(ref allVector4Columns, insertAt, numberOfNewRows); |
| | 0 | 379 | | InsertRowsOfTypeInternal(ref allVector2IntColumns, insertAt, numberOfNewRows); |
| | 0 | 380 | | InsertRowsOfTypeInternal(ref allVector3IntColumns, insertAt, numberOfNewRows); |
| | 0 | 381 | | InsertRowsOfTypeInternal(ref allQuaternionColumns, insertAt, numberOfNewRows); |
| | 0 | 382 | | InsertRowsOfTypeInternal(ref allRectColumns, insertAt, numberOfNewRows); |
| | 0 | 383 | | InsertRowsOfTypeInternal(ref allRectIntColumns, insertAt, numberOfNewRows); |
| | 0 | 384 | | InsertRowsOfTypeInternal(ref allColorColumns, insertAt, numberOfNewRows); |
| | 0 | 385 | | InsertRowsOfTypeInternal(ref allLayerMaskColumns, insertAt, numberOfNewRows); |
| | 0 | 386 | | InsertRowsOfTypeInternal(ref allBoundsColumns, insertAt, numberOfNewRows); |
| | 0 | 387 | | InsertRowsOfTypeInternal(ref allBoundsIntColumns, insertAt, numberOfNewRows); |
| | 0 | 388 | | InsertRowsOfTypeInternal(ref allHash128Columns, insertAt, numberOfNewRows); |
| | 0 | 389 | | InsertRowsOfTypeInternal(ref allGradientColumns, insertAt, numberOfNewRows); |
| | 0 | 390 | | InsertRowsOfTypeInternal(ref allAnimationCurveColumns, insertAt, numberOfNewRows); |
| | 0 | 391 | | InsertRowsOfTypeInternal(ref allObjectRefColumns, insertAt, numberOfNewRows); |
| | | 392 | | |
| | 0 | 393 | | rowCount += numberOfNewRows; |
| | 0 | 394 | | dataVersion++; |
| | 0 | 395 | | } |
| | | 396 | | |
| | | 397 | | public void AddRows(int numberOfNewRows, ref int[] rowIDs, string[] rowNames = null, int insertAtRowID = -1) |
| | 0 | 398 | | { |
| | 0 | 399 | | int rowIDToDenseIndexMapLength = rowIDToDenseIndexMap?.Length ?? 0; |
| | 0 | 400 | | int newCount = rowCount + numberOfNewRows; |
| | 0 | 401 | | if (newCount > rowIDToDenseIndexMapLength) |
| | 0 | 402 | | { |
| | 0 | 403 | | int newSize = newCount; |
| | 0 | 404 | | --newSize; |
| | 0 | 405 | | newSize |= newSize >> 1; |
| | 0 | 406 | | newSize |= newSize >> 2; |
| | 0 | 407 | | newSize |= newSize >> 4; |
| | 0 | 408 | | newSize |= newSize >> 8; |
| | 0 | 409 | | newSize |= newSize >> 16; |
| | 0 | 410 | | ++newSize; |
| | | 411 | | |
| | 0 | 412 | | newSize = newSize == 0 ? 1 : newSize; |
| | 0 | 413 | | Array.Resize(ref rowIDToDenseIndexMap, newSize); |
| | 0 | 414 | | for (int i = rowIDToDenseIndexMapLength; i < newSize; i++) |
| | 0 | 415 | | { |
| | 0 | 416 | | rowIDToDenseIndexMap[i] = i + 1; |
| | 0 | 417 | | } |
| | 0 | 418 | | } |
| | | 419 | | |
| | 0 | 420 | | int denseIndexToIDMapLength = rowDenseIndexToIDMap?.Length ?? 0; |
| | 0 | 421 | | Array.Resize(ref rowDenseIndexToIDMap, denseIndexToIDMapLength + numberOfNewRows); |
| | | 422 | | |
| | 0 | 423 | | int insertAt = insertAtRowID < 0 ? rowCount : rowIDToDenseIndexMap[insertAtRowID]; |
| | | 424 | | |
| | 0 | 425 | | for (int i = denseIndexToIDMapLength; i > insertAt + numberOfNewRows - 1; i--) |
| | 0 | 426 | | { |
| | 0 | 427 | | int currentRowID = rowDenseIndexToIDMap[i - numberOfNewRows]; |
| | 0 | 428 | | rowDenseIndexToIDMap[i] = currentRowID; |
| | | 429 | | |
| | 0 | 430 | | rowIDToDenseIndexMap[currentRowID] = i; |
| | | 431 | | |
| | 0 | 432 | | rowNames[i] = rowNames[i - numberOfNewRows]; |
| | 0 | 433 | | } |
| | | 434 | | |
| | 0 | 435 | | int freeListHead = rowEntriesFreeListHead; |
| | | 436 | | |
| | 0 | 437 | | for (int i = 0; i < numberOfNewRows; i++) |
| | 0 | 438 | | { |
| | 0 | 439 | | int rowID = freeListHead; |
| | 0 | 440 | | freeListHead = rowIDToDenseIndexMap[rowID]; |
| | 0 | 441 | | rowIDToDenseIndexMap[rowID] = insertAt + i; |
| | 0 | 442 | | rowDenseIndexToIDMap[insertAt + i] = rowID; |
| | 0 | 443 | | rowIDs[i] = rowID; |
| | 0 | 444 | | } |
| | | 445 | | |
| | 0 | 446 | | int numberOfNewRowNames = rowNames?.Length ?? 0; |
| | 0 | 447 | | for (int i = 0; i < numberOfNewRowNames; i++) |
| | 0 | 448 | | { |
| | 0 | 449 | | string currentRowName = rowNames[i]; |
| | 0 | 450 | | int rowIDAt = rowDenseIndexToIDMap[insertAt + i]; |
| | 0 | 451 | | rowNames[insertAt + i] = currentRowName == null ? rowIDAt.ToString() : currentRowName; |
| | 0 | 452 | | } |
| | | 453 | | |
| | 0 | 454 | | for (int i = numberOfNewRowNames; i < numberOfNewRows; i++) |
| | 0 | 455 | | { |
| | 0 | 456 | | int rowIDAt = rowDenseIndexToIDMap[insertAt + i]; |
| | 0 | 457 | | rowNames[insertAt + i] = rowIDAt.ToString(); |
| | 0 | 458 | | } |
| | | 459 | | |
| | 0 | 460 | | rowEntriesFreeListHead = freeListHead; |
| | | 461 | | |
| | 0 | 462 | | InsertRowsOfTypeInternal(ref allStringColumns, insertAt, numberOfNewRows); |
| | 0 | 463 | | InsertRowsOfTypeInternal(ref allBoolColumns, insertAt, numberOfNewRows); |
| | 0 | 464 | | InsertRowsOfTypeInternal(ref allCharColumns, insertAt, numberOfNewRows); |
| | 0 | 465 | | InsertRowsOfTypeInternal(ref allSbyteColumns, insertAt, numberOfNewRows); |
| | 0 | 466 | | InsertRowsOfTypeInternal(ref allByteColumns, insertAt, numberOfNewRows); |
| | 0 | 467 | | InsertRowsOfTypeInternal(ref allShortColumns, insertAt, numberOfNewRows); |
| | 0 | 468 | | InsertRowsOfTypeInternal(ref allUshortColumns, insertAt, numberOfNewRows); |
| | 0 | 469 | | InsertRowsOfTypeInternal(ref allIntColumns, insertAt, numberOfNewRows); |
| | 0 | 470 | | InsertRowsOfTypeInternal(ref allUintColumns, insertAt, numberOfNewRows); |
| | 0 | 471 | | InsertRowsOfTypeInternal(ref allLongColumns, insertAt, numberOfNewRows); |
| | 0 | 472 | | InsertRowsOfTypeInternal(ref allUlongColumns, insertAt, numberOfNewRows); |
| | 0 | 473 | | InsertRowsOfTypeInternal(ref allFloatColumns, insertAt, numberOfNewRows); |
| | 0 | 474 | | InsertRowsOfTypeInternal(ref allDoubleColumns, insertAt, numberOfNewRows); |
| | 0 | 475 | | InsertRowsOfTypeInternal(ref allVector2Columns, insertAt, numberOfNewRows); |
| | 0 | 476 | | InsertRowsOfTypeInternal(ref allVector3Columns, insertAt, numberOfNewRows); |
| | 0 | 477 | | InsertRowsOfTypeInternal(ref allVector4Columns, insertAt, numberOfNewRows); |
| | 0 | 478 | | InsertRowsOfTypeInternal(ref allVector2IntColumns, insertAt, numberOfNewRows); |
| | 0 | 479 | | InsertRowsOfTypeInternal(ref allVector3IntColumns, insertAt, numberOfNewRows); |
| | 0 | 480 | | InsertRowsOfTypeInternal(ref allQuaternionColumns, insertAt, numberOfNewRows); |
| | 0 | 481 | | InsertRowsOfTypeInternal(ref allRectColumns, insertAt, numberOfNewRows); |
| | 0 | 482 | | InsertRowsOfTypeInternal(ref allRectIntColumns, insertAt, numberOfNewRows); |
| | 0 | 483 | | InsertRowsOfTypeInternal(ref allColorColumns, insertAt, numberOfNewRows); |
| | 0 | 484 | | InsertRowsOfTypeInternal(ref allLayerMaskColumns, insertAt, numberOfNewRows); |
| | 0 | 485 | | InsertRowsOfTypeInternal(ref allBoundsColumns, insertAt, numberOfNewRows); |
| | 0 | 486 | | InsertRowsOfTypeInternal(ref allBoundsIntColumns, insertAt, numberOfNewRows); |
| | 0 | 487 | | InsertRowsOfTypeInternal(ref allHash128Columns, insertAt, numberOfNewRows); |
| | 0 | 488 | | InsertRowsOfTypeInternal(ref allGradientColumns, insertAt, numberOfNewRows); |
| | 0 | 489 | | InsertRowsOfTypeInternal(ref allAnimationCurveColumns, insertAt, numberOfNewRows); |
| | 0 | 490 | | InsertRowsOfTypeInternal(ref allObjectRefColumns, insertAt, numberOfNewRows); |
| | | 491 | | |
| | 0 | 492 | | rowCount += numberOfNewRows; |
| | 0 | 493 | | dataVersion++; |
| | 0 | 494 | | } |
| | | 495 | | |
| | | 496 | | public void RemoveRow(int rowID) |
| | 0 | 497 | | { |
| | 0 | 498 | | int rowDenseIndex = rowIDToDenseIndexMap[rowID]; |
| | 0 | 499 | | for (int i = rowDenseIndex + 1; i < rowCount; i++) |
| | 0 | 500 | | { |
| | 0 | 501 | | int currentRowID = rowDenseIndexToIDMap[i]; |
| | 0 | 502 | | rowIDToDenseIndexMap[currentRowID] = i - 1; |
| | 0 | 503 | | rowDenseIndexToIDMap[i - 1] = currentRowID; |
| | 0 | 504 | | rowNames[i - 1] = rowNames[i]; |
| | 0 | 505 | | } |
| | | 506 | | |
| | 0 | 507 | | rowIDToDenseIndexMap[rowID] = rowEntriesFreeListHead; |
| | 0 | 508 | | rowEntriesFreeListHead = rowID; |
| | 0 | 509 | | Array.Resize(ref rowDenseIndexToIDMap, rowCount - 1); |
| | 0 | 510 | | Array.Resize(ref rowNames, rowCount - 1); |
| | | 511 | | |
| | 0 | 512 | | DeleteRowsOfTypeInternal(ref allStringColumns, rowID, 1); |
| | 0 | 513 | | DeleteRowsOfTypeInternal(ref allBoolColumns, rowID, 1); |
| | 0 | 514 | | DeleteRowsOfTypeInternal(ref allCharColumns, rowID, 1); |
| | 0 | 515 | | DeleteRowsOfTypeInternal(ref allSbyteColumns, rowID, 1); |
| | 0 | 516 | | DeleteRowsOfTypeInternal(ref allByteColumns, rowID, 1); |
| | 0 | 517 | | DeleteRowsOfTypeInternal(ref allShortColumns, rowID, 1); |
| | 0 | 518 | | DeleteRowsOfTypeInternal(ref allUshortColumns, rowID, 1); |
| | 0 | 519 | | DeleteRowsOfTypeInternal(ref allIntColumns, rowID, 1); |
| | 0 | 520 | | DeleteRowsOfTypeInternal(ref allUintColumns, rowID, 1); |
| | 0 | 521 | | DeleteRowsOfTypeInternal(ref allLongColumns, rowID, 1); |
| | 0 | 522 | | DeleteRowsOfTypeInternal(ref allUlongColumns, rowID, 1); |
| | 0 | 523 | | DeleteRowsOfTypeInternal(ref allFloatColumns, rowID, 1); |
| | 0 | 524 | | DeleteRowsOfTypeInternal(ref allDoubleColumns, rowID, 1); |
| | 0 | 525 | | DeleteRowsOfTypeInternal(ref allVector2Columns, rowID, 1); |
| | 0 | 526 | | DeleteRowsOfTypeInternal(ref allVector3Columns, rowID, 1); |
| | 0 | 527 | | DeleteRowsOfTypeInternal(ref allVector4Columns, rowID, 1); |
| | 0 | 528 | | DeleteRowsOfTypeInternal(ref allVector2IntColumns, rowID, 1); |
| | 0 | 529 | | DeleteRowsOfTypeInternal(ref allVector3IntColumns, rowID, 1); |
| | 0 | 530 | | DeleteRowsOfTypeInternal(ref allQuaternionColumns, rowID, 1); |
| | 0 | 531 | | DeleteRowsOfTypeInternal(ref allRectColumns, rowID, 1); |
| | 0 | 532 | | DeleteRowsOfTypeInternal(ref allRectIntColumns, rowID, 1); |
| | 0 | 533 | | DeleteRowsOfTypeInternal(ref allColorColumns, rowID, 1); |
| | 0 | 534 | | DeleteRowsOfTypeInternal(ref allLayerMaskColumns, rowID, 1); |
| | 0 | 535 | | DeleteRowsOfTypeInternal(ref allBoundsColumns, rowID, 1); |
| | 0 | 536 | | DeleteRowsOfTypeInternal(ref allBoundsIntColumns, rowID, 1); |
| | 0 | 537 | | DeleteRowsOfTypeInternal(ref allHash128Columns, rowID, 1); |
| | 0 | 538 | | DeleteRowsOfTypeInternal(ref allGradientColumns, rowID, 1); |
| | 0 | 539 | | DeleteRowsOfTypeInternal(ref allAnimationCurveColumns, rowID, 1); |
| | 0 | 540 | | DeleteRowsOfTypeInternal(ref allObjectRefColumns, rowID, 1); |
| | | 541 | | |
| | 0 | 542 | | --rowCount; |
| | 0 | 543 | | dataVersion++; |
| | 0 | 544 | | } |
| | | 545 | | |
| | | 546 | | public int AddColumn(Serializable.SerializableTypes columnType, string columnName, int insertAtColumnID = -1) |
| | 0 | 547 | | { |
| | 0 | 548 | | switch (columnType) |
| | | 549 | | { |
| | | 550 | | case Serializable.SerializableTypes.String: |
| | 0 | 551 | | return AddColumnInternal(columnName, ref allStringColumns, Serializable.SerializableTypes.String, in |
| | | 552 | | case Serializable.SerializableTypes.Char: |
| | 0 | 553 | | return AddColumnInternal(columnName, ref allCharColumns, Serializable.SerializableTypes.Char, insert |
| | | 554 | | case Serializable.SerializableTypes.Bool: |
| | 0 | 555 | | return AddColumnInternal(columnName, ref allBoolColumns, Serializable.SerializableTypes.Bool, insert |
| | | 556 | | case Serializable.SerializableTypes.SByte: |
| | 0 | 557 | | return AddColumnInternal(columnName, ref allSbyteColumns, Serializable.SerializableTypes.SByte, inse |
| | | 558 | | case Serializable.SerializableTypes.Byte: |
| | 0 | 559 | | return AddColumnInternal(columnName, ref allByteColumns, Serializable.SerializableTypes.Byte, insert |
| | | 560 | | case Serializable.SerializableTypes.Short: |
| | 0 | 561 | | return AddColumnInternal(columnName, ref allShortColumns, Serializable.SerializableTypes.Short, inse |
| | | 562 | | case Serializable.SerializableTypes.UShort: |
| | 0 | 563 | | return AddColumnInternal(columnName, ref allUshortColumns, Serializable.SerializableTypes.UShort, in |
| | | 564 | | case Serializable.SerializableTypes.Int: |
| | 0 | 565 | | return AddColumnInternal(columnName, ref allIntColumns, Serializable.SerializableTypes.Int, insertAt |
| | | 566 | | case Serializable.SerializableTypes.UInt: |
| | 0 | 567 | | return AddColumnInternal(columnName, ref allUintColumns, Serializable.SerializableTypes.UInt, insert |
| | | 568 | | case Serializable.SerializableTypes.Long: |
| | 0 | 569 | | return AddColumnInternal(columnName, ref allLongColumns, Serializable.SerializableTypes.Long, insert |
| | | 570 | | case Serializable.SerializableTypes.ULong: |
| | 0 | 571 | | return AddColumnInternal(columnName, ref allUlongColumns, Serializable.SerializableTypes.ULong, inse |
| | | 572 | | case Serializable.SerializableTypes.Float: |
| | 0 | 573 | | return AddColumnInternal(columnName, ref allFloatColumns, Serializable.SerializableTypes.Float, inse |
| | | 574 | | case Serializable.SerializableTypes.Double: |
| | 0 | 575 | | return AddColumnInternal(columnName, ref allDoubleColumns, Serializable.SerializableTypes.Double, in |
| | | 576 | | case Serializable.SerializableTypes.Vector2: |
| | 0 | 577 | | return AddColumnInternal(columnName, ref allVector2Columns, Serializable.SerializableTypes.Vector2, |
| | | 578 | | case Serializable.SerializableTypes.Vector3: |
| | 0 | 579 | | return AddColumnInternal(columnName, ref allVector3Columns, Serializable.SerializableTypes.Vector3, |
| | | 580 | | case Serializable.SerializableTypes.Vector4: |
| | 0 | 581 | | return AddColumnInternal(columnName, ref allVector4Columns, Serializable.SerializableTypes.Vector4, |
| | | 582 | | case Serializable.SerializableTypes.Vector2Int: |
| | 0 | 583 | | return AddColumnInternal(columnName, ref allVector2IntColumns, Serializable.SerializableTypes.Vector |
| | | 584 | | case Serializable.SerializableTypes.Vector3Int: |
| | 0 | 585 | | return AddColumnInternal(columnName, ref allVector3IntColumns, Serializable.SerializableTypes.Vector |
| | | 586 | | case Serializable.SerializableTypes.Quaternion: |
| | 0 | 587 | | return AddColumnInternal(columnName, ref allQuaternionColumns, Serializable.SerializableTypes.Quater |
| | | 588 | | case Serializable.SerializableTypes.Rect: |
| | 0 | 589 | | return AddColumnInternal(columnName, ref allRectColumns, Serializable.SerializableTypes.Rect, insert |
| | | 590 | | case Serializable.SerializableTypes.RectInt: |
| | 0 | 591 | | return AddColumnInternal(columnName, ref allRectIntColumns, Serializable.SerializableTypes.RectInt, |
| | | 592 | | case Serializable.SerializableTypes.Color: |
| | 0 | 593 | | return AddColumnInternal(columnName, ref allColorColumns, Serializable.SerializableTypes.Color, inse |
| | | 594 | | case Serializable.SerializableTypes.LayerMask: |
| | 0 | 595 | | return AddColumnInternal(columnName, ref allLayerMaskColumns, Serializable.SerializableTypes.LayerMa |
| | | 596 | | case Serializable.SerializableTypes.Bounds: |
| | 0 | 597 | | return AddColumnInternal(columnName, ref allBoundsColumns, Serializable.SerializableTypes.Bounds, in |
| | | 598 | | case Serializable.SerializableTypes.BoundsInt: |
| | 0 | 599 | | return AddColumnInternal(columnName, ref allBoundsIntColumns, Serializable.SerializableTypes.BoundsI |
| | | 600 | | case Serializable.SerializableTypes.Hash128: |
| | 0 | 601 | | return AddColumnInternal(columnName, ref allHash128Columns, Serializable.SerializableTypes.Hash128, |
| | | 602 | | case Serializable.SerializableTypes.Gradient: |
| | 0 | 603 | | return AddColumnInternal(columnName, ref allGradientColumns, Serializable.SerializableTypes.Gradient |
| | | 604 | | case Serializable.SerializableTypes.AnimationCurve: |
| | 0 | 605 | | return AddColumnInternal(columnName, ref allAnimationCurveColumns, Serializable.SerializableTypes.An |
| | | 606 | | case Serializable.SerializableTypes.Object: |
| | 0 | 607 | | return AddColumnInternal(columnName, ref allObjectRefColumns, Serializable.SerializableTypes.Object, |
| | | 608 | | } |
| | 0 | 609 | | return -1; |
| | 0 | 610 | | } |
| | | 611 | | |
| | | 612 | | public void RemoveColumn(Serializable.SerializableTypes columnType, int columnID) |
| | 0 | 613 | | { |
| | 0 | 614 | | switch (columnType) |
| | | 615 | | { |
| | | 616 | | case Serializable.SerializableTypes.String: |
| | 0 | 617 | | RemoveColumnInternal(ref allStringColumns, Serializable.SerializableTypes.String, columnID); |
| | 0 | 618 | | break; |
| | | 619 | | case Serializable.SerializableTypes.Char: |
| | 0 | 620 | | RemoveColumnInternal(ref allCharColumns, Serializable.SerializableTypes.Char, columnID); |
| | 0 | 621 | | break; |
| | | 622 | | case Serializable.SerializableTypes.Bool: |
| | 0 | 623 | | RemoveColumnInternal(ref allBoolColumns, Serializable.SerializableTypes.Bool, columnID); |
| | 0 | 624 | | break; |
| | | 625 | | case Serializable.SerializableTypes.SByte: |
| | 0 | 626 | | RemoveColumnInternal(ref allSbyteColumns, Serializable.SerializableTypes.SByte, columnID); |
| | 0 | 627 | | break; |
| | | 628 | | case Serializable.SerializableTypes.Byte: |
| | 0 | 629 | | RemoveColumnInternal(ref allByteColumns, Serializable.SerializableTypes.Byte, columnID); |
| | 0 | 630 | | break; |
| | | 631 | | case Serializable.SerializableTypes.Short: |
| | 0 | 632 | | RemoveColumnInternal(ref allShortColumns, Serializable.SerializableTypes.Short, columnID); |
| | 0 | 633 | | break; |
| | | 634 | | case Serializable.SerializableTypes.UShort: |
| | 0 | 635 | | RemoveColumnInternal(ref allUshortColumns, Serializable.SerializableTypes.UShort, columnID); |
| | 0 | 636 | | break; |
| | | 637 | | case Serializable.SerializableTypes.Int: |
| | 0 | 638 | | RemoveColumnInternal(ref allIntColumns, Serializable.SerializableTypes.Int, columnID); |
| | 0 | 639 | | break; |
| | | 640 | | case Serializable.SerializableTypes.UInt: |
| | 0 | 641 | | RemoveColumnInternal(ref allUintColumns, Serializable.SerializableTypes.UInt, columnID); |
| | 0 | 642 | | break; |
| | | 643 | | case Serializable.SerializableTypes.Long: |
| | 0 | 644 | | RemoveColumnInternal(ref allLongColumns, Serializable.SerializableTypes.Long, columnID); |
| | 0 | 645 | | break; |
| | | 646 | | case Serializable.SerializableTypes.ULong: |
| | 0 | 647 | | RemoveColumnInternal(ref allUlongColumns, Serializable.SerializableTypes.ULong, columnID); |
| | 0 | 648 | | break; |
| | | 649 | | case Serializable.SerializableTypes.Float: |
| | 0 | 650 | | RemoveColumnInternal(ref allFloatColumns, Serializable.SerializableTypes.Float, columnID); |
| | 0 | 651 | | break; |
| | | 652 | | case Serializable.SerializableTypes.Double: |
| | 0 | 653 | | RemoveColumnInternal(ref allDoubleColumns, Serializable.SerializableTypes.Double, columnID); |
| | 0 | 654 | | break; |
| | | 655 | | case Serializable.SerializableTypes.Vector2: |
| | 0 | 656 | | RemoveColumnInternal(ref allVector2Columns, Serializable.SerializableTypes.Vector2, columnID); |
| | 0 | 657 | | break; |
| | | 658 | | case Serializable.SerializableTypes.Vector3: |
| | 0 | 659 | | RemoveColumnInternal(ref allVector3Columns, Serializable.SerializableTypes.Vector3, columnID); |
| | 0 | 660 | | break; |
| | | 661 | | case Serializable.SerializableTypes.Vector4: |
| | 0 | 662 | | RemoveColumnInternal(ref allVector4Columns, Serializable.SerializableTypes.Vector4, columnID); |
| | 0 | 663 | | break; |
| | | 664 | | case Serializable.SerializableTypes.Vector2Int: |
| | 0 | 665 | | RemoveColumnInternal(ref allVector2IntColumns, Serializable.SerializableTypes.Vector2Int, columnID); |
| | 0 | 666 | | break; |
| | | 667 | | case Serializable.SerializableTypes.Vector3Int: |
| | 0 | 668 | | RemoveColumnInternal(ref allVector3IntColumns, Serializable.SerializableTypes.Vector3Int, columnID); |
| | 0 | 669 | | break; |
| | | 670 | | case Serializable.SerializableTypes.Quaternion: |
| | 0 | 671 | | RemoveColumnInternal(ref allQuaternionColumns, Serializable.SerializableTypes.Quaternion, columnID); |
| | 0 | 672 | | break; |
| | | 673 | | case Serializable.SerializableTypes.Rect: |
| | 0 | 674 | | RemoveColumnInternal(ref allRectColumns, Serializable.SerializableTypes.Rect, columnID); |
| | 0 | 675 | | break; |
| | | 676 | | case Serializable.SerializableTypes.RectInt: |
| | 0 | 677 | | RemoveColumnInternal(ref allRectIntColumns, Serializable.SerializableTypes.RectInt, columnID); |
| | 0 | 678 | | break; |
| | | 679 | | case Serializable.SerializableTypes.Color: |
| | 0 | 680 | | RemoveColumnInternal(ref allColorColumns, Serializable.SerializableTypes.Color, columnID); |
| | 0 | 681 | | break; |
| | | 682 | | case Serializable.SerializableTypes.LayerMask: |
| | 0 | 683 | | RemoveColumnInternal(ref allLayerMaskColumns, Serializable.SerializableTypes.LayerMask, columnID); |
| | 0 | 684 | | break; |
| | | 685 | | case Serializable.SerializableTypes.Bounds: |
| | 0 | 686 | | RemoveColumnInternal(ref allBoundsColumns, Serializable.SerializableTypes.Bounds, columnID); |
| | 0 | 687 | | break; |
| | | 688 | | case Serializable.SerializableTypes.BoundsInt: |
| | 0 | 689 | | RemoveColumnInternal(ref allBoundsIntColumns, Serializable.SerializableTypes.BoundsInt, columnID); |
| | 0 | 690 | | break; |
| | | 691 | | case Serializable.SerializableTypes.Hash128: |
| | 0 | 692 | | RemoveColumnInternal(ref allHash128Columns, Serializable.SerializableTypes.Hash128, columnID); |
| | 0 | 693 | | break; |
| | | 694 | | case Serializable.SerializableTypes.Gradient: |
| | 0 | 695 | | RemoveColumnInternal(ref allGradientColumns, Serializable.SerializableTypes.Gradient, columnID); |
| | 0 | 696 | | break; |
| | | 697 | | case Serializable.SerializableTypes.AnimationCurve: |
| | 0 | 698 | | RemoveColumnInternal(ref allAnimationCurveColumns, Serializable.SerializableTypes.AnimationCurve, co |
| | 0 | 699 | | break; |
| | | 700 | | case Serializable.SerializableTypes.Object: |
| | 0 | 701 | | RemoveColumnInternal(ref allObjectRefColumns, Serializable.SerializableTypes.Object, columnID); |
| | 0 | 702 | | break; |
| | | 703 | | } |
| | 0 | 704 | | } |
| | | 705 | | |
| | | 706 | | // Set |
| | | 707 | | |
| | | 708 | | public ulong SetString(int row, int column, string value) |
| | 0 | 709 | | { |
| | 0 | 710 | | return SetCell(row, column, ref allStringColumns, value); |
| | 0 | 711 | | } |
| | | 712 | | |
| | | 713 | | public ulong SetBool(int row, int column, bool value) |
| | 0 | 714 | | { |
| | 0 | 715 | | return SetCell(row, column, ref allBoolColumns, value); |
| | 0 | 716 | | } |
| | | 717 | | |
| | | 718 | | public ulong SetChar(int row, int column, char value) |
| | 0 | 719 | | { |
| | 0 | 720 | | return SetCell(row, column, ref allCharColumns, value); |
| | 0 | 721 | | } |
| | | 722 | | |
| | | 723 | | public ulong SetSByte(int row, int column, sbyte value) |
| | 0 | 724 | | { |
| | 0 | 725 | | return SetCell(row, column, ref allSbyteColumns, value); |
| | 0 | 726 | | } |
| | | 727 | | |
| | | 728 | | public ulong SetByte(int row, int column, byte value) |
| | 0 | 729 | | { |
| | 0 | 730 | | return SetCell(row, column, ref allByteColumns, value); |
| | 0 | 731 | | } |
| | | 732 | | |
| | | 733 | | public ulong SetShort(int row, int column, short value) |
| | 0 | 734 | | { |
| | 0 | 735 | | return SetCell(row, column, ref allShortColumns, value); |
| | 0 | 736 | | } |
| | | 737 | | |
| | | 738 | | public ulong SetUShort(int row, int column, ushort value) |
| | 0 | 739 | | { |
| | 0 | 740 | | return SetCell(row, column, ref allUshortColumns, value); |
| | 0 | 741 | | } |
| | | 742 | | |
| | | 743 | | public ulong SetInt(int row, int column, int value) |
| | 0 | 744 | | { |
| | 0 | 745 | | return SetCell(row, column, ref allIntColumns, value); |
| | 0 | 746 | | } |
| | | 747 | | |
| | | 748 | | public ulong SetUInt(int row, int column, uint value) |
| | 0 | 749 | | { |
| | 0 | 750 | | return SetCell(row, column, ref allUintColumns, value); |
| | 0 | 751 | | } |
| | | 752 | | |
| | | 753 | | public ulong SetLong(int row, int column, long value) |
| | 0 | 754 | | { |
| | 0 | 755 | | return SetCell(row, column, ref allLongColumns, value); |
| | 0 | 756 | | } |
| | | 757 | | |
| | | 758 | | public ulong SetULong(int row, int column, ulong value) |
| | 0 | 759 | | { |
| | 0 | 760 | | return SetCell(row, column, ref allUlongColumns, value); |
| | 0 | 761 | | } |
| | | 762 | | |
| | | 763 | | public ulong SetFloat(int row, int column, float value) |
| | 0 | 764 | | { |
| | 0 | 765 | | return SetCell(row, column, ref allFloatColumns, value); |
| | 0 | 766 | | } |
| | | 767 | | |
| | | 768 | | public ulong SetDouble(int row, int column, double value) |
| | 0 | 769 | | { |
| | 0 | 770 | | return SetCell(row, column, ref allDoubleColumns, value); |
| | 0 | 771 | | } |
| | | 772 | | |
| | | 773 | | public ulong SetVector2(int row, int column, Vector2 value) |
| | 0 | 774 | | { |
| | 0 | 775 | | return SetCell(row, column, ref allVector2Columns, value); |
| | 0 | 776 | | } |
| | | 777 | | |
| | | 778 | | public ulong SetVector3(int row, int column, Vector3 value) |
| | 0 | 779 | | { |
| | 0 | 780 | | return SetCell(row, column, ref allVector3Columns, value); |
| | 0 | 781 | | } |
| | | 782 | | |
| | | 783 | | public ulong SetVector4(int row, int column, Vector4 value) |
| | 0 | 784 | | { |
| | 0 | 785 | | return SetCell(row, column, ref allVector4Columns, value); |
| | 0 | 786 | | } |
| | | 787 | | |
| | | 788 | | public ulong SetVector2Int(int row, int column, Vector2Int value) |
| | 0 | 789 | | { |
| | 0 | 790 | | return SetCell(row, column, ref allVector2IntColumns, value); |
| | 0 | 791 | | } |
| | | 792 | | |
| | | 793 | | public ulong SetVector3Int(int row, int column, Vector3Int value) |
| | 0 | 794 | | { |
| | 0 | 795 | | return SetCell(row, column, ref allVector3IntColumns, value); |
| | 0 | 796 | | } |
| | | 797 | | |
| | | 798 | | public ulong SetQuaternion(int row, int column, Quaternion value) |
| | 0 | 799 | | { |
| | 0 | 800 | | return SetCell(row, column, ref allQuaternionColumns, value); |
| | 0 | 801 | | } |
| | | 802 | | |
| | | 803 | | public ulong SetRect(int row, int column, Rect value) |
| | 0 | 804 | | { |
| | 0 | 805 | | return SetCell(row, column, ref allRectColumns, value); |
| | 0 | 806 | | } |
| | | 807 | | |
| | | 808 | | public ulong SetRectInt(int row, int column, RectInt value) |
| | 0 | 809 | | { |
| | 0 | 810 | | return SetCell(row, column, ref allRectIntColumns, value); |
| | 0 | 811 | | } |
| | | 812 | | |
| | | 813 | | public ulong SetColor(int row, int column, Color value) |
| | 0 | 814 | | { |
| | 0 | 815 | | return SetCell(row, column, ref allColorColumns, value); |
| | 0 | 816 | | } |
| | | 817 | | |
| | | 818 | | public ulong SetLayerMask(int row, int column, LayerMask value) |
| | 0 | 819 | | { |
| | 0 | 820 | | return SetCell(row, column, ref allLayerMaskColumns, value); |
| | 0 | 821 | | } |
| | | 822 | | |
| | | 823 | | public ulong SetBounds(int row, int column, Bounds value) |
| | 0 | 824 | | { |
| | 0 | 825 | | return SetCell(row, column, ref allBoundsColumns, value); |
| | 0 | 826 | | } |
| | | 827 | | |
| | | 828 | | public ulong SetBoundsInt(int row, int column, BoundsInt value) |
| | 0 | 829 | | { |
| | 0 | 830 | | return SetCell(row, column, ref allBoundsIntColumns, value); |
| | 0 | 831 | | } |
| | | 832 | | |
| | | 833 | | public ulong SetHash128(int row, int column, Hash128 value) |
| | 0 | 834 | | { |
| | 0 | 835 | | return SetCell(row, column, ref allHash128Columns, value); |
| | 0 | 836 | | } |
| | | 837 | | |
| | | 838 | | public ulong SetGradient(int row, int column, Gradient value) |
| | 0 | 839 | | { |
| | 0 | 840 | | return SetCell(row, column, ref allGradientColumns, value); |
| | 0 | 841 | | } |
| | | 842 | | |
| | | 843 | | public ulong SetAnimationCurve(int row, int column, AnimationCurve value) |
| | 0 | 844 | | { |
| | 0 | 845 | | return SetCell(row, column, ref allAnimationCurveColumns, value); |
| | 0 | 846 | | } |
| | | 847 | | |
| | | 848 | | public ulong SetObject(int row, int column, UnityEngine.Object value) |
| | 0 | 849 | | { |
| | 0 | 850 | | return SetCell(row, column, ref allObjectRefColumns, value); |
| | 0 | 851 | | } |
| | | 852 | | |
| | | 853 | | // Get |
| | | 854 | | public string GetString(int row, int column) |
| | 0 | 855 | | { |
| | 0 | 856 | | return GetCell(row, column, ref allStringColumns); |
| | 0 | 857 | | } |
| | | 858 | | |
| | | 859 | | public bool GetBool(int row, int column) |
| | 0 | 860 | | { |
| | 0 | 861 | | return GetCell(row, column, ref allBoolColumns); |
| | 0 | 862 | | } |
| | | 863 | | |
| | | 864 | | public char GetChar(int row, int column) |
| | 0 | 865 | | { |
| | 0 | 866 | | return GetCell(row, column, ref allCharColumns); |
| | 0 | 867 | | } |
| | | 868 | | |
| | | 869 | | public sbyte GetSByte(int row, int column) |
| | 0 | 870 | | { |
| | 0 | 871 | | return GetCell(row, column, ref allSbyteColumns); |
| | 0 | 872 | | } |
| | | 873 | | |
| | | 874 | | public byte GetByte(int row, int column) |
| | 0 | 875 | | { |
| | 0 | 876 | | return GetCell(row, column, ref allByteColumns); |
| | 0 | 877 | | } |
| | | 878 | | |
| | | 879 | | public short GetShort(int row, int column) |
| | 0 | 880 | | { |
| | 0 | 881 | | return GetCell(row, column, ref allShortColumns); |
| | 0 | 882 | | } |
| | | 883 | | |
| | | 884 | | public ushort GetUShort(int row, int column) |
| | 0 | 885 | | { |
| | 0 | 886 | | return GetCell(row, column, ref allUshortColumns); |
| | 0 | 887 | | } |
| | | 888 | | |
| | | 889 | | public int GetInt(int row, int column) |
| | 0 | 890 | | { |
| | 0 | 891 | | return GetCell(row, column, ref allIntColumns); |
| | 0 | 892 | | } |
| | | 893 | | |
| | | 894 | | public uint GetUInt(int row, int column) |
| | 0 | 895 | | { |
| | 0 | 896 | | return GetCell(row, column, ref allUintColumns); |
| | 0 | 897 | | } |
| | | 898 | | |
| | | 899 | | public long GetLong(int row, int column) |
| | 0 | 900 | | { |
| | 0 | 901 | | return GetCell(row, column, ref allLongColumns); |
| | 0 | 902 | | } |
| | | 903 | | |
| | | 904 | | public ulong GetULong(int row, int column) |
| | 0 | 905 | | { |
| | 0 | 906 | | return GetCell(row, column, ref allUlongColumns); |
| | 0 | 907 | | } |
| | | 908 | | |
| | | 909 | | public float GetFloat(int row, int column) |
| | 0 | 910 | | { |
| | 0 | 911 | | return GetCell(row, column, ref allFloatColumns); |
| | 0 | 912 | | } |
| | | 913 | | |
| | | 914 | | public double GetDouble(int row, int column) |
| | 0 | 915 | | { |
| | 0 | 916 | | return GetCell(row, column, ref allDoubleColumns); |
| | 0 | 917 | | } |
| | | 918 | | |
| | | 919 | | public Vector2 GetVector2(int row, int column) |
| | 0 | 920 | | { |
| | 0 | 921 | | return GetCell(row, column, ref allVector2Columns); |
| | 0 | 922 | | } |
| | | 923 | | |
| | | 924 | | public Vector3 GetVector3(int row, int column) |
| | 0 | 925 | | { |
| | 0 | 926 | | return GetCell(row, column, ref allVector3Columns); |
| | 0 | 927 | | } |
| | | 928 | | |
| | | 929 | | public Vector4 GetVector4(int row, int column) |
| | 0 | 930 | | { |
| | 0 | 931 | | return GetCell(row, column, ref allVector4Columns); |
| | 0 | 932 | | } |
| | | 933 | | |
| | | 934 | | public Vector2Int GetVector2Int(int row, int column) |
| | 0 | 935 | | { |
| | 0 | 936 | | return GetCell(row, column, ref allVector2IntColumns); |
| | 0 | 937 | | } |
| | | 938 | | |
| | | 939 | | public Vector3Int GetVector3Int(int row, int column) |
| | 0 | 940 | | { |
| | 0 | 941 | | return GetCell(row, column, ref allVector3IntColumns); |
| | 0 | 942 | | } |
| | | 943 | | |
| | | 944 | | public Quaternion GetQuaternion(int row, int column) |
| | 0 | 945 | | { |
| | 0 | 946 | | return GetCell(row, column, ref allQuaternionColumns); |
| | 0 | 947 | | } |
| | | 948 | | |
| | | 949 | | public Rect GetRect(int row, int column) |
| | 0 | 950 | | { |
| | 0 | 951 | | return GetCell(row, column, ref allRectColumns); |
| | 0 | 952 | | } |
| | | 953 | | |
| | | 954 | | public RectInt GetRectInt(int row, int column) |
| | 0 | 955 | | { |
| | 0 | 956 | | return GetCell(row, column, ref allRectIntColumns); |
| | 0 | 957 | | } |
| | | 958 | | |
| | | 959 | | public Color GetColor(int row, int column) |
| | 0 | 960 | | { |
| | 0 | 961 | | return GetCell(row, column, ref allColorColumns); |
| | 0 | 962 | | } |
| | | 963 | | |
| | | 964 | | public LayerMask GetLayerMask(int row, int column) |
| | 0 | 965 | | { |
| | 0 | 966 | | return GetCell(row, column, ref allLayerMaskColumns); |
| | 0 | 967 | | } |
| | | 968 | | |
| | | 969 | | public Bounds GetBounds(int row, int column) |
| | 0 | 970 | | { |
| | 0 | 971 | | return GetCell(row, column, ref allBoundsColumns); |
| | 0 | 972 | | } |
| | | 973 | | |
| | | 974 | | public BoundsInt GetBoundsInt(int row, int column) |
| | 0 | 975 | | { |
| | 0 | 976 | | return GetCell(row, column, ref allBoundsIntColumns); |
| | 0 | 977 | | } |
| | | 978 | | |
| | | 979 | | public Hash128 GetHash128(int row, int column) |
| | 0 | 980 | | { |
| | 0 | 981 | | return GetCell(row, column, ref allHash128Columns); |
| | 0 | 982 | | } |
| | | 983 | | |
| | | 984 | | public Gradient GetGradient(int row, int column) |
| | 0 | 985 | | { |
| | 0 | 986 | | return GetCell(row, column, ref allGradientColumns); |
| | 0 | 987 | | } |
| | | 988 | | |
| | | 989 | | public AnimationCurve GetAnimationCurve(int row, int column) |
| | 0 | 990 | | { |
| | 0 | 991 | | return GetCell(row, column, ref allAnimationCurveColumns); |
| | 0 | 992 | | } |
| | | 993 | | |
| | | 994 | | public UnityEngine.Object GetObject(int row, int column) |
| | 0 | 995 | | { |
| | 0 | 996 | | return GetCell(row, column, ref allObjectRefColumns); |
| | 0 | 997 | | } |
| | | 998 | | |
| | | 999 | | // Get ref |
| | | 1000 | | |
| | | 1001 | | public ref string GetStringRef(int row, int column) |
| | 0 | 1002 | | { |
| | 0 | 1003 | | return ref GetCellRef(row, column, ref allStringColumns); |
| | 0 | 1004 | | } |
| | | 1005 | | |
| | | 1006 | | public ref bool GetBoolRef(int row, int column) |
| | 0 | 1007 | | { |
| | 0 | 1008 | | return ref GetCellRef(row, column, ref allBoolColumns); |
| | 0 | 1009 | | } |
| | | 1010 | | |
| | | 1011 | | public ref char GetCharRef(int row, int column) |
| | 0 | 1012 | | { |
| | 0 | 1013 | | return ref GetCellRef(row, column, ref allCharColumns); |
| | 0 | 1014 | | } |
| | | 1015 | | |
| | | 1016 | | public ref sbyte GetSbyteRef(int row, int column) |
| | 0 | 1017 | | { |
| | 0 | 1018 | | return ref GetCellRef(row, column, ref allSbyteColumns); |
| | 0 | 1019 | | } |
| | | 1020 | | |
| | | 1021 | | public ref byte GetByteRef(int row, int columnID) |
| | 0 | 1022 | | { |
| | 0 | 1023 | | return ref GetCellRef(row, columnID, ref allByteColumns); |
| | 0 | 1024 | | } |
| | | 1025 | | |
| | | 1026 | | public ref short GetShortRef(int row, int column) |
| | 0 | 1027 | | { |
| | 0 | 1028 | | return ref GetCellRef(row, column, ref allShortColumns); |
| | 0 | 1029 | | } |
| | | 1030 | | |
| | | 1031 | | public ref ushort GetUshortRef(int row, int column) |
| | 0 | 1032 | | { |
| | 0 | 1033 | | return ref GetCellRef(row, column, ref allUshortColumns); |
| | 0 | 1034 | | } |
| | | 1035 | | |
| | | 1036 | | public ref int GetIntRef(int row, int column) |
| | 0 | 1037 | | { |
| | 0 | 1038 | | return ref GetCellRef(row, column, ref allIntColumns); |
| | 0 | 1039 | | } |
| | | 1040 | | |
| | | 1041 | | public ref uint GetUintRef(int row, int column) |
| | 0 | 1042 | | { |
| | 0 | 1043 | | return ref GetCellRef(row, column, ref allUintColumns); |
| | 0 | 1044 | | } |
| | | 1045 | | |
| | | 1046 | | public ref long GetLongRef(int row, int column) |
| | 0 | 1047 | | { |
| | 0 | 1048 | | return ref GetCellRef(row, column, ref allLongColumns); |
| | 0 | 1049 | | } |
| | | 1050 | | |
| | | 1051 | | public ref ulong GetUlongRef(int row, int column) |
| | 0 | 1052 | | { |
| | 0 | 1053 | | return ref GetCellRef(row, column, ref allUlongColumns); |
| | 0 | 1054 | | } |
| | | 1055 | | |
| | | 1056 | | public ref float GetFloatRef(int row, int column) |
| | 0 | 1057 | | { |
| | 0 | 1058 | | return ref GetCellRef(row, column, ref allFloatColumns); |
| | 0 | 1059 | | } |
| | | 1060 | | |
| | | 1061 | | public ref double GetDoubleRef(int row, int column) |
| | 0 | 1062 | | { |
| | 0 | 1063 | | return ref GetCellRef(row, column, ref allDoubleColumns); |
| | 0 | 1064 | | } |
| | | 1065 | | |
| | | 1066 | | public ref Vector2 GetVector2Ref(int row, int column) |
| | 0 | 1067 | | { |
| | 0 | 1068 | | return ref GetCellRef(row, column, ref allVector2Columns); |
| | 0 | 1069 | | } |
| | | 1070 | | |
| | | 1071 | | public ref Vector3 GetVector3Ref(int row, int column) |
| | 0 | 1072 | | { |
| | 0 | 1073 | | return ref GetCellRef(row, column, ref allVector3Columns); |
| | 0 | 1074 | | } |
| | | 1075 | | |
| | | 1076 | | public ref Vector4 GetVector4Ref(int row, int column) |
| | 0 | 1077 | | { |
| | 0 | 1078 | | return ref GetCellRef(row, column, ref allVector4Columns); |
| | 0 | 1079 | | } |
| | | 1080 | | |
| | | 1081 | | public ref Vector2Int GetVector2IntRef(int row, int column) |
| | 0 | 1082 | | { |
| | 0 | 1083 | | return ref GetCellRef(row, column, ref allVector2IntColumns); |
| | 0 | 1084 | | } |
| | | 1085 | | |
| | | 1086 | | public ref Vector3Int GetVector3IntRef(int row, int column) |
| | 0 | 1087 | | { |
| | 0 | 1088 | | return ref GetCellRef(row, column, ref allVector3IntColumns); |
| | 0 | 1089 | | } |
| | | 1090 | | |
| | | 1091 | | public ref Quaternion GetQuaternionRef(int row, int column) |
| | 0 | 1092 | | { |
| | 0 | 1093 | | return ref GetCellRef(row, column, ref allQuaternionColumns); |
| | 0 | 1094 | | } |
| | | 1095 | | |
| | | 1096 | | public ref Rect GetRectRef(int row, int column) |
| | 0 | 1097 | | { |
| | 0 | 1098 | | return ref GetCellRef(row, column, ref allRectColumns); |
| | 0 | 1099 | | } |
| | | 1100 | | |
| | | 1101 | | public ref RectInt GetRectIntRef(int row, int column) |
| | 0 | 1102 | | { |
| | 0 | 1103 | | return ref GetCellRef(row, column, ref allRectIntColumns); |
| | 0 | 1104 | | } |
| | | 1105 | | |
| | | 1106 | | public ref Color GetColorRef(int row, int column) |
| | 0 | 1107 | | { |
| | 0 | 1108 | | return ref GetCellRef(row, column, ref allColorColumns); |
| | 0 | 1109 | | } |
| | | 1110 | | |
| | | 1111 | | public ref LayerMask GetLayerMaskRef(int row, int column) |
| | 0 | 1112 | | { |
| | 0 | 1113 | | return ref GetCellRef(row, column, ref allLayerMaskColumns); |
| | 0 | 1114 | | } |
| | | 1115 | | |
| | | 1116 | | public ref Bounds GetBoundsRef(int row, int column) |
| | 0 | 1117 | | { |
| | 0 | 1118 | | return ref GetCellRef(row, column, ref allBoundsColumns); |
| | 0 | 1119 | | } |
| | | 1120 | | |
| | | 1121 | | public ref BoundsInt GetBoundsIntRef(int row, int column) |
| | 0 | 1122 | | { |
| | 0 | 1123 | | return ref GetCellRef(row, column, ref allBoundsIntColumns); |
| | 0 | 1124 | | } |
| | | 1125 | | |
| | | 1126 | | public ref Hash128 GetHash128Ref(int row, int column) |
| | 0 | 1127 | | { |
| | 0 | 1128 | | return ref GetCellRef(row, column, ref allHash128Columns); |
| | 0 | 1129 | | } |
| | | 1130 | | |
| | | 1131 | | public ref Gradient GetGradientRef(int row, int column) |
| | 0 | 1132 | | { |
| | 0 | 1133 | | return ref GetCellRef(row, column, ref allGradientColumns); |
| | 0 | 1134 | | } |
| | | 1135 | | |
| | | 1136 | | public ref AnimationCurve GetAnimationCurveRef(int row, int column) |
| | 0 | 1137 | | { |
| | 0 | 1138 | | return ref GetCellRef(row, column, ref allAnimationCurveColumns); |
| | 0 | 1139 | | } |
| | | 1140 | | |
| | | 1141 | | public ref UnityEngine.Object GetObjectRef(int row, int column) |
| | 0 | 1142 | | { |
| | 0 | 1143 | | return ref GetCellRef(row, column, ref allObjectRefColumns); |
| | 0 | 1144 | | } |
| | | 1145 | | |
| | | 1146 | | // Get Column |
| | | 1147 | | |
| | | 1148 | | public string[] GetStringColumn(int column) |
| | 0 | 1149 | | { |
| | 0 | 1150 | | return GetColumn(column, ref allStringColumns); |
| | 0 | 1151 | | } |
| | | 1152 | | |
| | | 1153 | | public bool[] GetBoolColumn(int column) |
| | 0 | 1154 | | { |
| | 0 | 1155 | | return GetColumn(column, ref allBoolColumns); |
| | 0 | 1156 | | } |
| | | 1157 | | |
| | | 1158 | | public char[] GetCharColumn(int column) |
| | 0 | 1159 | | { |
| | 0 | 1160 | | return GetColumn(column, ref allCharColumns); |
| | 0 | 1161 | | } |
| | | 1162 | | |
| | | 1163 | | public sbyte[] GetSbyteColumn(int column) |
| | 0 | 1164 | | { |
| | 0 | 1165 | | return GetColumn(column, ref allSbyteColumns); |
| | 0 | 1166 | | } |
| | | 1167 | | |
| | | 1168 | | public byte[] GetByteColumn(int column) |
| | 0 | 1169 | | { |
| | 0 | 1170 | | return GetColumn(column, ref allByteColumns); |
| | 0 | 1171 | | } |
| | | 1172 | | |
| | | 1173 | | public short[] GetShortColumn(int column) |
| | 0 | 1174 | | { |
| | 0 | 1175 | | return GetColumn(column, ref allShortColumns); |
| | 0 | 1176 | | } |
| | | 1177 | | |
| | | 1178 | | public ushort[] GetUshortColumn(int column) |
| | 0 | 1179 | | { |
| | 0 | 1180 | | return GetColumn(column, ref allUshortColumns); |
| | 0 | 1181 | | } |
| | | 1182 | | |
| | | 1183 | | public int[] GetIntColumn(int column) |
| | 0 | 1184 | | { |
| | 0 | 1185 | | return GetColumn(column, ref allIntColumns); |
| | 0 | 1186 | | } |
| | | 1187 | | |
| | | 1188 | | public uint[] GetUintColumn(int column) |
| | 0 | 1189 | | { |
| | 0 | 1190 | | return GetColumn(column, ref allUintColumns); |
| | 0 | 1191 | | } |
| | | 1192 | | |
| | | 1193 | | public long[] GetLongColumn(int column) |
| | 0 | 1194 | | { |
| | 0 | 1195 | | return GetColumn(column, ref allLongColumns); |
| | 0 | 1196 | | } |
| | | 1197 | | |
| | | 1198 | | public ulong[] GetUlongColumn(int column) |
| | 0 | 1199 | | { |
| | 0 | 1200 | | return GetColumn(column, ref allUlongColumns); |
| | 0 | 1201 | | } |
| | | 1202 | | |
| | | 1203 | | public float[] GetFloatColumn(int column) |
| | 0 | 1204 | | { |
| | 0 | 1205 | | return GetColumn(column, ref allFloatColumns); |
| | 0 | 1206 | | } |
| | | 1207 | | |
| | | 1208 | | public double[] GetDoubleColumn(int column) |
| | 0 | 1209 | | { |
| | 0 | 1210 | | return GetColumn(column, ref allDoubleColumns); |
| | 0 | 1211 | | } |
| | | 1212 | | |
| | | 1213 | | public Vector2[] GetVector2Column(int column) |
| | 0 | 1214 | | { |
| | 0 | 1215 | | return GetColumn(column, ref allVector2Columns); |
| | 0 | 1216 | | } |
| | | 1217 | | |
| | | 1218 | | public Vector3[] GetVector3Column(int column) |
| | 0 | 1219 | | { |
| | 0 | 1220 | | return GetColumn(column, ref allVector3Columns); |
| | 0 | 1221 | | } |
| | | 1222 | | |
| | | 1223 | | public Vector4[] GetVector4Column(int column) |
| | 0 | 1224 | | { |
| | 0 | 1225 | | return GetColumn(column, ref allVector4Columns); |
| | 0 | 1226 | | } |
| | | 1227 | | |
| | | 1228 | | public Vector2Int[] GetVector2IntColumn(int column) |
| | 0 | 1229 | | { |
| | 0 | 1230 | | return GetColumn(column, ref allVector2IntColumns); |
| | 0 | 1231 | | } |
| | | 1232 | | |
| | | 1233 | | public Vector3Int[] GetVector3IntColumn(int column) |
| | 0 | 1234 | | { |
| | 0 | 1235 | | return GetColumn(column, ref allVector3IntColumns); |
| | 0 | 1236 | | } |
| | | 1237 | | |
| | | 1238 | | public Quaternion[] GetQuaternionColumn(int column) |
| | 0 | 1239 | | { |
| | 0 | 1240 | | return GetColumn(column, ref allQuaternionColumns); |
| | 0 | 1241 | | } |
| | | 1242 | | |
| | | 1243 | | public Rect[] GetRectColumn(int column) |
| | 0 | 1244 | | { |
| | 0 | 1245 | | return GetColumn(column, ref allRectColumns); |
| | 0 | 1246 | | } |
| | | 1247 | | |
| | | 1248 | | public RectInt[] GetRectIntColumn(int column) |
| | 0 | 1249 | | { |
| | 0 | 1250 | | return GetColumn(column, ref allRectIntColumns); |
| | 0 | 1251 | | } |
| | | 1252 | | |
| | | 1253 | | public Color[] GetColorColumn(int column) |
| | 0 | 1254 | | { |
| | 0 | 1255 | | return GetColumn(column, ref allColorColumns); |
| | 0 | 1256 | | } |
| | | 1257 | | |
| | | 1258 | | public LayerMask[] GetLayerMaskColumn(int column) |
| | 0 | 1259 | | { |
| | 0 | 1260 | | return GetColumn(column, ref allLayerMaskColumns); |
| | 0 | 1261 | | } |
| | | 1262 | | |
| | | 1263 | | public Bounds[] GetBoundsColumn(int column) |
| | 0 | 1264 | | { |
| | 0 | 1265 | | return GetColumn(column, ref allBoundsColumns); |
| | 0 | 1266 | | } |
| | | 1267 | | |
| | | 1268 | | public BoundsInt[] GetBoundsIntColumn(int column) |
| | 0 | 1269 | | { |
| | 0 | 1270 | | return GetColumn(column, ref allBoundsIntColumns); |
| | 0 | 1271 | | } |
| | | 1272 | | |
| | | 1273 | | public Hash128[] GetHash128Column(int column) |
| | 0 | 1274 | | { |
| | 0 | 1275 | | return GetColumn(column, ref allHash128Columns); |
| | 0 | 1276 | | } |
| | | 1277 | | |
| | | 1278 | | public Gradient[] GetGradientColumn(int column) |
| | 0 | 1279 | | { |
| | 0 | 1280 | | return GetColumn(column, ref allGradientColumns); |
| | 0 | 1281 | | } |
| | | 1282 | | |
| | | 1283 | | public AnimationCurve[] GetAnimationCurveColumn(int column) |
| | 0 | 1284 | | { |
| | 0 | 1285 | | return GetColumn(column, ref allAnimationCurveColumns); |
| | 0 | 1286 | | } |
| | | 1287 | | |
| | | 1288 | | public UnityEngine.Object[] GetObjectColumn(int column) |
| | 0 | 1289 | | { |
| | 0 | 1290 | | return GetColumn(column, ref allObjectRefColumns); |
| | 0 | 1291 | | } |
| | | 1292 | | |
| | | 1293 | | // Internal |
| | | 1294 | | |
| | | 1295 | | internal int AddColumnInternal<T>(string columnName, ref ArrayHolder<T>[] allColumnsOfType, Serializable.Seriali |
| | 0 | 1296 | | { |
| | 0 | 1297 | | int columnCount = allColumnsOfType?.Length ?? 0; |
| | 0 | 1298 | | Array.Resize(ref allColumnsOfType, columnCount + 1); |
| | 0 | 1299 | | allColumnsOfType[columnCount].TArray = new T[rowCount]; |
| | | 1300 | | |
| | 0 | 1301 | | int columnID = columnEntriesFreeListHead; |
| | 0 | 1302 | | string[] columnNamesForType = allColumnNames[(int)typeIndex].TArray; |
| | 0 | 1303 | | int columnNamesCount = columnNamesForType?.Length ?? 0; |
| | 0 | 1304 | | Array.Resize(ref columnNamesForType, columnNamesCount + 1); |
| | 0 | 1305 | | columnNamesForType[columnNamesCount] = columnName == null ? columnID.ToString() : columnName; |
| | 0 | 1306 | | allColumnNames[(int)typeIndex].TArray = columnNamesForType; |
| | | 1307 | | |
| | | 1308 | | |
| | 0 | 1309 | | int columnIDToDenseIndexMapLength = columnIDToDenseIndexMap?.Length ?? 0; |
| | 0 | 1310 | | if (columnID >= columnIDToDenseIndexMapLength) |
| | 0 | 1311 | | { |
| | 0 | 1312 | | int newSize = columnIDToDenseIndexMapLength * 2; |
| | 0 | 1313 | | newSize = newSize == 0 ? 1 : newSize; |
| | 0 | 1314 | | Array.Resize(ref columnIDToDenseIndexMap, newSize); |
| | 0 | 1315 | | for (int i = columnIDToDenseIndexMapLength; i < newSize; i++) |
| | 0 | 1316 | | { |
| | 0 | 1317 | | ref ColumnEntry entry = ref columnIDToDenseIndexMap[i]; |
| | 0 | 1318 | | entry.columnDenseIndex = i + 1; |
| | 0 | 1319 | | entry.ColumnType = Serializable.SerializableTypes.Invalid; |
| | 0 | 1320 | | } |
| | | 1321 | | |
| | 0 | 1322 | | Array.Resize(ref columnIDToSortOrderMap, newSize); |
| | 0 | 1323 | | for (int i = columnIDToDenseIndexMapLength; i < newSize; i++) |
| | 0 | 1324 | | { |
| | 0 | 1325 | | columnIDToSortOrderMap[i] = -1; |
| | 0 | 1326 | | } |
| | 0 | 1327 | | } |
| | | 1328 | | |
| | 0 | 1329 | | ref int[] denseIndexToIDMap = ref columnDenseIndexToIDMap[(int)typeIndex].TArray; |
| | 0 | 1330 | | int denseIndexToIDMapLength = denseIndexToIDMap?.Length ?? 0; |
| | 0 | 1331 | | Array.Resize(ref denseIndexToIDMap, denseIndexToIDMapLength + 1); |
| | 0 | 1332 | | denseIndexToIDMap[denseIndexToIDMapLength] = columnID; |
| | | 1333 | | |
| | 0 | 1334 | | ref ColumnEntry newEntry = ref columnIDToDenseIndexMap[columnID]; |
| | 0 | 1335 | | newEntry.columnDenseIndex = denseIndexToIDMapLength; |
| | 0 | 1336 | | newEntry.ColumnType = typeIndex; |
| | | 1337 | | |
| | 0 | 1338 | | insertAtSortedIndex = insertAtSortedIndex < 0 ? combinedColumnCount : insertAtSortedIndex; |
| | 0 | 1339 | | Array.Resize(ref sortedOrderToColumnIDMap, combinedColumnCount + 1); |
| | 0 | 1340 | | for (int i = combinedColumnCount; i > insertAtSortedIndex; i--) |
| | 0 | 1341 | | { |
| | 0 | 1342 | | int currentColumnID = sortedOrderToColumnIDMap[i - 1]; |
| | 0 | 1343 | | sortedOrderToColumnIDMap[i] = currentColumnID; |
| | 0 | 1344 | | columnIDToSortOrderMap[currentColumnID] = i; |
| | 0 | 1345 | | } |
| | | 1346 | | |
| | 0 | 1347 | | columnEntriesFreeListHead = columnIDToDenseIndexMap[columnID].columnDenseIndex; |
| | 0 | 1348 | | columnIDToSortOrderMap[columnID] = insertAtSortedIndex; |
| | 0 | 1349 | | sortedOrderToColumnIDMap[insertAtSortedIndex] = columnID; |
| | | 1350 | | |
| | 0 | 1351 | | ++combinedColumnCount; |
| | 0 | 1352 | | dataVersion++; |
| | | 1353 | | |
| | 0 | 1354 | | return columnID; |
| | 0 | 1355 | | } |
| | | 1356 | | |
| | | 1357 | | internal void RemoveColumnInternal<T>(ref ArrayHolder<T>[] allColumnsOfType, Serializable.SerializableTypes type |
| | 0 | 1358 | | { |
| | 0 | 1359 | | int columnLocation = columnIDToDenseIndexMap[columnID].columnDenseIndex; |
| | | 1360 | | |
| | 0 | 1361 | | int lastIndex = allColumnsOfType.Length - 1; |
| | 0 | 1362 | | allColumnsOfType[columnLocation] = allColumnsOfType[lastIndex]; |
| | 0 | 1363 | | Array.Resize(ref allColumnsOfType, lastIndex); |
| | | 1364 | | |
| | 0 | 1365 | | ref string[] columnNamesOfType = ref allColumnNames[(int)typeIndex].TArray; |
| | 0 | 1366 | | columnNamesOfType[columnLocation] = columnNamesOfType[lastIndex]; |
| | 0 | 1367 | | Array.Resize(ref columnNamesOfType, lastIndex); |
| | | 1368 | | |
| | 0 | 1369 | | int columnOrder = columnIDToSortOrderMap[columnID]; |
| | | 1370 | | |
| | 0 | 1371 | | ref int[] denseIndicesOfType = ref columnDenseIndexToIDMap[(int)typeIndex].TArray; |
| | 0 | 1372 | | int sparseIndexToSwap = denseIndicesOfType[lastIndex]; |
| | | 1373 | | |
| | 0 | 1374 | | ref ColumnEntry sparseIndexToFree = ref columnIDToDenseIndexMap[columnID]; |
| | 0 | 1375 | | sparseIndexToFree.ColumnType = Serializable.SerializableTypes.Invalid; |
| | 0 | 1376 | | sparseIndexToFree.columnDenseIndex = columnEntriesFreeListHead; |
| | 0 | 1377 | | columnEntriesFreeListHead = columnID; |
| | | 1378 | | |
| | 0 | 1379 | | columnIDToDenseIndexMap[sparseIndexToSwap].columnDenseIndex = columnLocation; |
| | 0 | 1380 | | denseIndicesOfType[columnLocation] = sparseIndexToSwap; |
| | 0 | 1381 | | Array.Resize(ref denseIndicesOfType, lastIndex); |
| | | 1382 | | |
| | 0 | 1383 | | for (int i = columnOrder + 1; i < combinedColumnCount; i++) |
| | 0 | 1384 | | { |
| | 0 | 1385 | | int currentColumnID = sortedOrderToColumnIDMap[i]; |
| | 0 | 1386 | | sortedOrderToColumnIDMap[i - 1] = currentColumnID; |
| | 0 | 1387 | | columnIDToSortOrderMap[currentColumnID] = i - 1; |
| | 0 | 1388 | | } |
| | | 1389 | | |
| | 0 | 1390 | | Array.Resize(ref sortedOrderToColumnIDMap, combinedColumnCount - 1); |
| | | 1391 | | |
| | 0 | 1392 | | --combinedColumnCount; |
| | 0 | 1393 | | dataVersion++; |
| | 0 | 1394 | | } |
| | | 1395 | | |
| | | 1396 | | internal void InsertRowsOfTypeInternal<T>(ref ArrayHolder<T>[] allColumnsOfType, int insertAt, int numberOfNewRo |
| | 0 | 1397 | | { |
| | 0 | 1398 | | int columnCount = allColumnsOfType?.Length ?? 0; |
| | 0 | 1399 | | for (int i = 0; i < columnCount; i++) |
| | 0 | 1400 | | { |
| | 0 | 1401 | | ref T[] column = ref allColumnsOfType[i].TArray; |
| | 0 | 1402 | | int newRowCount = rowCount + numberOfNewRows; |
| | 0 | 1403 | | Array.Resize(ref column, newRowCount); |
| | 0 | 1404 | | for (int j = newRowCount - 1; j > insertAt + numberOfNewRows - 1; j--) |
| | 0 | 1405 | | { |
| | 0 | 1406 | | column[j] = column[j - numberOfNewRows]; |
| | 0 | 1407 | | } |
| | | 1408 | | |
| | 0 | 1409 | | for (int j = 0; j < numberOfNewRows; j++) |
| | 0 | 1410 | | { |
| | 0 | 1411 | | column[insertAt + j] = default; |
| | 0 | 1412 | | } |
| | 0 | 1413 | | } |
| | 0 | 1414 | | } |
| | | 1415 | | |
| | | 1416 | | internal void DeleteRowsOfTypeInternal<T>(ref ArrayHolder<T>[] allColumnsOfType, int removeAt, int numberOfRowsT |
| | 0 | 1417 | | { |
| | 0 | 1418 | | int columnCount = allColumnsOfType?.Length ?? 0; |
| | | 1419 | | |
| | 0 | 1420 | | for (int i = 0; i < columnCount; i++) |
| | 0 | 1421 | | { |
| | 0 | 1422 | | ref T[] column = ref allColumnsOfType[i].TArray; |
| | 0 | 1423 | | int newRowCount = rowCount - numberOfRowsToDelete; |
| | | 1424 | | |
| | 0 | 1425 | | for (int j = removeAt; j < rowCount - numberOfRowsToDelete; j++) |
| | 0 | 1426 | | { |
| | 0 | 1427 | | column[j] = column[j + numberOfRowsToDelete]; |
| | 0 | 1428 | | } |
| | | 1429 | | |
| | 0 | 1430 | | Array.Resize(ref column, newRowCount); |
| | 0 | 1431 | | } |
| | 0 | 1432 | | } |
| | | 1433 | | |
| | | 1434 | | internal ref T GetCellRef<T>(int rowID, int columnID, ref ArrayHolder<T>[] allColumnsOfType) |
| | 0 | 1435 | | { |
| | 0 | 1436 | | int column = columnIDToDenseIndexMap[columnID].columnDenseIndex; |
| | 0 | 1437 | | return ref allColumnsOfType[column][rowID]; |
| | 0 | 1438 | | } |
| | | 1439 | | |
| | | 1440 | | internal T GetCell<T>(int rowID, int columnID, ref ArrayHolder<T>[] allColumnsOfType) |
| | 0 | 1441 | | { |
| | 0 | 1442 | | int column = columnIDToDenseIndexMap[columnID].columnDenseIndex; |
| | 0 | 1443 | | return allColumnsOfType[column][rowID]; |
| | 0 | 1444 | | } |
| | | 1445 | | |
| | | 1446 | | internal ulong SetCell<T>(int rowID, int columnID, ref ArrayHolder<T>[] allColumnsOfType, T value) |
| | 0 | 1447 | | { |
| | 0 | 1448 | | int column = columnIDToDenseIndexMap[columnID].columnDenseIndex; |
| | 0 | 1449 | | allColumnsOfType[column][rowID] = value; |
| | 0 | 1450 | | dataVersion++; |
| | 0 | 1451 | | return dataVersion; |
| | 0 | 1452 | | } |
| | | 1453 | | |
| | | 1454 | | internal T[] GetColumn<T>(int columnID, ref ArrayHolder<T>[] allColumnsOfType) |
| | 0 | 1455 | | { |
| | 0 | 1456 | | int column = columnIDToDenseIndexMap[columnID].columnDenseIndex; |
| | 0 | 1457 | | return allColumnsOfType[column].TArray; |
| | 0 | 1458 | | } |
| | | 1459 | | } |
| | | 1460 | | } |